import requests

a = requests.get("http://books.toscrape.com/")

print(a)

print(a.status_code)


if a.status_code ==200:
    print("请求成功，状态码为：",a.status_code)
    print(a.text)
else:
    print("失败")

# if a.ok:
#     print(a.text)
# else:
#     print("失败")